<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .box{
            width: 100px;
            height: 100px;
            background-color: lightpink;
        }
        body{
            height: 2000px;
        }
    </style>
</head>
<body>
    <div class="box"></div>

    <script>
        var box = document.querySelector('.box');
        // window.onscroll = function () {
        //     console.log('页面卷入的距离 ===>', window.pageYOffset);
        //     console.log('页面卷入的距离 ===>', document.documentElement.scrollTop);
        // }
        console.log(document.documentElement);
        // 无法通过document.documentElementz挂载滚动事件
        document.documentElement.scroll = function () {
            console.log('object');
        }
    </script>
</body>
</html>